package com.example.mapper;

import com.example.entity.Teacher;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface TeacherMapper {
    List<Teacher> selectAll(Teacher teacher);

    //通过专业查询所属学院的老师
    List<Teacher> selectByMajorId(Integer majorId);

    @Insert("insert into teacher (teacher_id,teacher_name,teacher_number,college_id) values (#{teacherId},#{teacherName},#{teacherNumber},#{collegeId})")
    void insert(Teacher teacher);

    @Update("update teacher set teacher_name=#{teacherName},teacher_number=#{teacherNumber},college_id=#{collegeId} where teacher_id=#{teacherId}")
    void updateTeacher(Teacher teacher);

    @Delete("delete from teacher where teacher_id=#{teacherId}")
    void deleteTeacher(Integer teacherId);

    @Select("select count(*) from teacher where teacher_number=#{teacherNumber}")
    int countByNumber(String teacherNumber);

    @Select("select * from teacher where teacher_id=#{teacherId}")
    Teacher selevtById(Integer teacherId);
}
